//
//  DoctorApplyController.m
//  项目唯一
//
//  Created by 谌桃 on 16/7/6.
//  Copyright © 2016年 ryan.chen. All rights reserved.
//

#import "DoctorApplyController.h"

@interface DoctorApplyController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong)UITableView * tableView;
@property (nonatomic, strong)NSMutableArray * doctorArr;

@end

@implementation DoctorApplyController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
    [self loadData];
    self.title = @"名医通申请";
}

- (void)setupUI{

    
    [self.view addSubview:self.tableView];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.right.left.mas_equalTo(0);
    }];
}

- (void)loadData{

    DoctorApplyDTO *dto1 = [DoctorApplyDTO doctorApplyDTOWithName:@"张先生" caseString:@"高血压" cureTimeString:@"就诊:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"审核中"];
    
    DoctorApplyDTO *dto2 = [DoctorApplyDTO doctorApplyDTOWithName:@"李先生" caseString:@"心血管" cureTimeString:@"就诊:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"审核中"];
    
    DoctorApplyDTO *dto3 = [DoctorApplyDTO doctorApplyDTOWithName:@"王先生" caseString:@"骨科病" cureTimeString:@"就诊:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"已就诊"];
    
    DoctorApplyDTO *dto4 = [DoctorApplyDTO doctorApplyDTOWithName:@"赵先生" caseString:@"心塞梗塞" cureTimeString:@"就诊:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"已就诊"];
    
    DoctorApplyDTO *dto5 = [DoctorApplyDTO doctorApplyDTOWithName:@"马先生" caseString:@"关节炎" cureTimeString:@"就诊:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"审核中"];
    
    DoctorApplyDTO *dto6 = [DoctorApplyDTO doctorApplyDTOWithName:@"过先生" caseString:@"腰肌劳损" cureTimeString:@"就诊时间:2016/06/19" doctor:@"马医生" doctor_calss:@"主任医生" hospitol:@"上海长征医院" cureState:@"已就诊"];
    
    [self.doctorArr addObject:dto1];
    [self.doctorArr addObject:dto2];
    [self.doctorArr addObject:dto3];
    [self.doctorArr addObject:dto4];
    [self.doctorArr addObject:dto5];
    [self.doctorArr addObject:dto6];
}

#pragma dataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.doctorArr.count;
}

#pragma delegate
static NSString *identifierID = @"identifier";
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    DoctorApplyCell * cell = (DoctorApplyCell *)[tableView dequeueReusableCellWithIdentifier:identifierID];
    
    if (cell == nil) {
        cell = [[DoctorApplyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifierID];
    }
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    cell.dto = self.doctorArr[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma Lazy
- (UITableView *)tableView{

    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.rowHeight = 90;
        
    }
    return _tableView;
}

- (NSMutableArray *)doctorArr{

    if (!_doctorArr) {
        _doctorArr = [NSMutableArray array];
    }
    return _doctorArr;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
